<!doctype html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>主数据管理平台</title>
        <meta name="renderer" content="webkit|ie-comp|ie-stand">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <meta http-equiv="Cache-Control" content="no-siteapp" />
        <link rel="shortcut icon" href="common/images/title.png" type="image/x-icon">
        <script type="text/javascript" src="./common/js/public.js"></script>
        <script type="text/javascript" src="./common/js/publicUtils.js"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
        <![endif]-->
        <script>
            // 是否开启刷新记忆tab功能
            var is_remember = false;
        </script>
      <style>
            .layui-nav .layui-nav-child dd:hover ul{
              display: block;
              position: absolute;
              top: 2px;
              left :100px;
              background: #1E9FFF;
              box-shadow: 0 2px 4px rgba(0,0,0,.12);
              border: 1px solid #d2d2d2;
              border-radius: 2px;
          }
            .layui-tab-more {
                padding-right: 30px;
                height: auto !important;
                white-space: normal !important;
                width: 95% !important;
            }

          .layui-nav .layui-nav-child dd ul{display: none;}
          .layui-nav .layui-nav-child dd ul a:hover{background: #f0f0f0}
        </style>
    </head>
    <body class="index">
        <!-- 顶部开始 -->
        <div class="container layui-row">
            <div class="logo">
                <a href="./main.html"  style="font-size: 15px">主数据管理平台</a></div>
            <div class="left_open">
                <a><i title="展开左侧栏" class="iconfont">&#xe699;</i></a>
            </div>

            <ul class="layui-nav right layui-col-md2" lay-filter="">
                <li class="layui-nav-item">
                    <a><i class="iconfont">&#xe713;</i></a>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;" id="loginName">admin</a>
                    <dl class="layui-nav-child">
                        <!-- 二级菜单 -->
                        <dd>
                            <a onclick="changePassword()">修改密码</a></dd>
                        <!--<dd>-->
                            <!--<a onclick="xadmin.open('切换帐号','http://www.baidu.com')">切换帐号</a></dd>-->
                        <dd>
                            <a onclick="loginout()">注销帐号</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item" style="margin-left: 25px;cursor:pointer" id="full-screen-btn" onclick="gobackBoard()">全屏显示</li>
               <!-- <li class="layui-nav-item to-index">
                    <a href="./main.html">前台首页</a></li > -->
            </ul>
        </div>
        <!-- 顶部结束 -->
        <!-- 中部开始 -->
        <!-- 左侧菜单开始 -->
        <div class="left-nav">
            <div id="side-nav">
                <ul id="nav">
                    
                </ul>
            </div>
        </div>
        <div class="x-slide_left">
			<i class="layui-icon layui-icon-left" style="color:white"></i>
		</div>
        <!-- 左侧菜单结束 -->
        <!-- 右侧主体开始 -->
        <div class="page-content">
            <div class="layui-tab tab" lay-filter="xbs_tab" lay-allowclose="false">
                <ul class="layui-tab-title" style="width:98%;float:left;">
                    <li class="home">
                        <i class="layui-icon">&#xe68e;</i>我的桌面</li></ul>
                <button style="right: 40px; border-left: solid 1px #ccc;float:right;width:2%;height:36px;" id="refresh_iframe" class="layui-btn layui-btn-normal" title="刷新">
                    <i class="layui-icon  layui-icon-refresh"></i>
                </button>
                <div class="layui-unselect layui-form-select layui-form-selected" id="tab_right">
                    <dl>
                        <dd data-type="this">关闭当前</dd>
                        <dd data-type="other">关闭其它</dd>
                        <dd data-type="all">关闭全部</dd></dl>
                </div>
                <div class="layui-tab-content">
                    <div class="layui-tab-item layui-show">
                        <iframe src='./welcome.html' frameborder="0" scrolling="yes" class="x-iframe"></iframe>
                    </div>
                </div>
                <div id="tab_show"></div>
            </div>
        </div>
        <div class="page-content-bg"></div>
        <style id="theme_style"></style>
        <!-- 右侧主体结束 -->
        <!-- 中部结束 -->
        <script>
            window.onresize = function(){//全屏展示和退出全屏
                if(!checkFull()){
                    if ($("#full-screen-btn").text() == "退出全屏") {
                        parent.exitQ();
                        $("#full-screen-btn").text("全屏显示");
                    }
                }
            }

            function checkFull(){
                var isFull =
                    document.fullscreenElement ||
                    document.mozFullScreenElement ||
                    document.webkitFullscreenElement;
                //to fix : false || undefined == undefined
                if(isFull === undefined) isFull = false;
                return isFull;
            }
			var loginName='',loginId='';
			$(document).ready(function(){
                loadmenutree(-1);

                // 刷新iframe
                $("#refresh_iframe").click(function() {
                    var node = $(".layui-tab-content .layui-tab-item.layui-show").find(".body-iframe");
                    if(node[0]){
                        $(".layui-tab-content .layui-tab-item.layui-show").find(".body-iframe")[0].contentWindow.location.reload(true);
                    }
                });
			});
			function getInfo(){
                publicAjax(null,'login/getPerson',{},null,null,function(r){
                    if(r.code==2000){
                        loginName=r.data.loginName;
                        $("#loginName").html(loginName+"<span class='layui-nav-more'></span>");
                        loginId=r.data.id;
                    }
                })
            }
			window.onload=function(){
				openLeftMenu();
			}


        /**
         * 加载左侧菜单
         */
        function loadmenutree(flag){
			    var containdata = new Array();
			    publicAjax(null,'sysmenu/selectById',{'id':flag,'type':1},null,null,function(r){
                    var menustr = "";
                    if(r.code==2000){
                        var data = r.data;
                        $.each(data,function(i,e){
                            menustr +=  '<li>'+
                                '<a href="javascript:;">'+
                                "<img src='"+publicResourceUrl+e.icon+"' class='iconfont left-nav-li' lay-tips='"+e.name+"' />&nbsp;"+
                                // '<i class="iconfont left-nav-li" lay-tips="'+e.name+'">&#xe6b4;</i>'+
                                '<cite>'+e.name+'</cite>'+
                                '<i class="iconfont nav_right">&#xe697;</i></a>'+
                                '<ul class="sub-menu">';
                            $.each(e.obj,function(j,e1){
                                menustr += '<li>'+
                                    "<a onclick=\"xadmin.add_tab('"+e1.id+"','"+e1.name+"','"+e1.url+"')\" >"+
                                    "<img src='"+publicResourceUrl+e1.icon+"' class='iconfont' />&nbsp;"+
                                    "<cite>"+e1.name+"</cite></a>"+
                                    '</li>';

                            })
                            menustr += '</ul></li>';
                        })
                        $("#nav").html(menustr);
						getInfo();
                    }else{
                        layerror(r.msg?r.msg:'获取失败！');
                    }
                })
            }

            function gobackBoard(){
                //window.location.href="/mdm/CTCE/main.html";
                /*全屏显示*/
                if ($("#full-screen-btn").text() == "全屏显示") {
                    parent.fullscreen();
                    $("#full-screen-btn").text("退出全屏");
                } else {
                    parent.exitQ();
                    $("#full-screen-btn").text("全屏显示");
                }
            }

            function changePassword(){
                var iframeWin ;
                layer.open({
                    type: 2,
                    area: ["650px" , "400px"],
                    fix: false,
                    //不固定
                    maxmin: false,
                    shade: 0.3,
                    title: "修改密码",
                    content: publicUrl+"/CTCE/modules/logininfo/changepass.html",
                    btn: ['确定', '关闭'],
                    // 弹层外区域关闭
                    shadeClose: false,
                    yes: function(index, layero) {
                        var resultdata = iframeWin.contentWindow.updatePerson();
                        if(resultdata && resultdata.code==2000){
                            delayLoad(function(){
                                layer.closeAll();
                            })
                        }else {
                            return false;
                        }
                    },
                    cancel: function(index) {
                        return true;
                    },
                    success: function(layero, index){
                        iframeWin = layero.find('iframe')[0];
                        iframeWin.contentWindow.initData(loginName,loginId);
                    }
                });
            }

        </script>
    </body>

</html>